# My pseudo code for Exercice 2
# START 
#     Initialize sum to 0
#     FOUND <- False
#     list <- READ a list
#     Make the list in order "sort"
#     len <- the length of the list
#     FOR each item in the list:
#         sum <- sum+1
#         IF item =sum then:
#             CONTINUE
#         ELIF item !=sum then:
#             FOUND <- True
#             Display"Output:sum"
#             RESULT <- sum
#             Break
#         End IF
#     END FOR
#     IF FOUND=False then:
#         Display"Output:len+1"
#         RESULT <- len+1
#     END IF
#     Display:"Explanation: All the numbers from 1 to {len+1} are present except {RESULT}"
# END
def missing_number(arr):
    arr.sort()
    length=len(arr)
    Found=False
    for i in range(0,length):
        if arr[i]==i+1:
            continue
        else:
            print("Output::",i+1)
            print(f'Explanation: All the numbers from 1 to {length+1} are present except {i+1}.')
            Found=True
            break
    if Found==False:
        print("Output:",len+1)
        print(f'Explanation: All the numbers from 1 to {length+1} are present except {length+1}.')
        return len+1
missing_number([1,2,3,5])
missing_number([8,2,4,5,3,7,1])
   


